package cn.admin.remoting;

public class TRConstants {

    public static final byte PROCOCOL_VERSION = 13;
    public static final int PROTOCOL_HEADER_LENGTH = 14;
    public static final byte HEADER_REQUEST = 0;
    public static final byte HEADER_RESPONSE = 1;
    public static final byte HESSIAN_SERIALIZE = 1;
    public static final byte JAVA_SERIALIZE = 2;
    public static final byte TOP_SERIALIZE = 3;
    public static final byte HESSIAN2_SERIALIZE = 4;
    public static final byte HEADER_ONEWAY = 1;
    public static final byte HEADER_TWOWAY = 2;
    public static final String CONNECT_TIMEOUT_KEY = "_CONNECTTIMEOUT";
    public static final long DEFAULT_CONNECT_TIMEOUT = 1000L;
    public static final String IDLE_TIMEOUT_KEY = "_IDLETIMEOUT";
    public static final String MAX_READ_IDLE_KEY = "_MAXREADIDLETIME";
    public static final int DEFAULT_MAX_READ_IDLE = 30;
    public static final int MINA_WRITE_TIMEOUT = 10;
    public static final String SERIALIZE_TYPE_KEY = "_SERIALIZETYPE";
    public static final String TIMEOUT_TYPE_KEY = "_TIMEOUT";
    public static final long DEFAULT_REQUEST_TIMEOUT = 3000L;
    public static final String CONNECTION_META_KEY = "_CONNECTIONMETAKEY";
    public static final String AUTORECONNECT_KEY = "_AUTORECONNECT";
    public static final boolean DEFAULT_AUTORECONNECT = false;
    public static final String AUTORECONNECT_SLEEPTIME_KEY = "_AUTORECONNECT_SLEEPTIME";
    public static final long DEFAULT_AUTORECONNECT_SLEEPTIME = 1000L;
    public static final String HEARTBEAT_KEY = "_HEARBEAT";
    public static final boolean DEFAULT_HEARTBEAT = false;
    public static final String CONNECTIONNUM_KEY = "_CONNECTIONNUM";
    public static final int DEFAULT_CONNECTIONNUM = 1;
    public static final int RESULT_SUCCESS = 0;
    public static final int RESULT_ERROR = 1;
    public static final int RESULT_TIMEOUT = 2;
    public static final int RESULT_NO_HOST = 3;
    public static final int RESULT_SERVER_DESERIAL_FAIL = 4;
    public static final int RESULT_CLIENT_DESERIAL_FAIL = 5;
    public static final int RESULT_OVERFLOW = 4;

    public static String getResultCodeMsg(int resultCode) {
        switch(resultCode) {
            case 0:
                return "RESULT_SUCCESS";
            case 1:
                return "RESULT_ERROR";
            case 2:
                return "RESULT_TIMEOUT";
            case 3:
                return "RESULT_NO_HOST";
            case 4:
                return "RESULT_OVERFLOW";
            default:
                return "UnknownResultCode[" + resultCode + "]";
        }
    }

}
